# 导入flask
from flask import Flask
# 跨域
from flask_cors import CORS
# 导入sqlalchemy
from flask_sqlalchemy import SQLAlchemy

# 导入配制文件
from conf.config import Config

# 实例化
db = SQLAlchemy()


# 创建app方法
def create_app():
    # 初始化flask
    app = Flask(__name__)
    CORS(app)
    # 加载配制文件
    app.config.from_object(Config)
    # db注册app
    db.init_app(app)
    return app
